{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Users/ysw/code/NetEaseMusic\n"
     ]
    }
   ],
   "source": [
    "import os, sys\n",
    "\n",
    "\"\"\"\n",
    "add src to pythonpath\n",
    "\n",
    "attention: you can only run this cell once.\n",
    "\"\"\"\n",
    "\n",
    "path = os.path.abspath(os.path.join(os.getcwd(), os.pardir))\n",
    "os.chdir(path)\n",
    "\n",
    "print(path)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "model = {\n",
    "            'id': int,\n",
    "            'name': str,\n",
    "            'artists': list,\n",
    "            'album': dict,\n",
    "            'duration': str,\n",
    "            'mp3Url': str\n",
    "        }"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "False\n",
      "False\n",
      "True\n",
      "False\n",
      "False\n",
      "False\n"
     ]
    }
   ],
   "source": [
    "for key in model:\n",
    "    print((model[key]) == int)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "480 480\n"
     ]
    }
   ],
   "source": [
    "import sys\n",
    "\n",
    "\n",
    "data = {\n",
    "            'id': 1000000,\n",
    "            'name': 'test',\n",
    "            'artists': ['fsfasdf', 'fasdfa'],\n",
    "            'album': {'key':'value'},\n",
    "            'duration': '2.51',\n",
    "            'mp3Url': '122'\n",
    "        }\n",
    "\n",
    "\n",
    "print(sys.getsizeof(model), sys.getsizeof(data))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{}"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import imp\n",
    "import src.base.models as models\n",
    "\n",
    "imp.reload(models)\n",
    "\n",
    "mm = models.MusicModel(data)\n",
    "mm.validate()\n",
    "\n",
    "print(mm.get_model())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "type"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(int)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.4.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
